home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-159.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  43.3 KB  |  1,128 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Mon, 03 Aug 92       Volume 1 : Issue 159
  2.  
  3. Today's Topics:
  4.  
  5.     How to handle pdoc events - to quit or not to quit
  6.     Changing addressing mode without rebooting
  7.     The Answer to "Re: Serial output hangs"
  8.     Backgrounding Question?
  9.     _Delay should be banned
  10.     'vers' resource conventions
  11.     Info on the Twain API available ? 
  12.     Dialog Manager *too* 32-bit clean (was Re: Modal Dialog horrors and cdev's)
  13.     Does the threads library work with THINK C?
  14.     Patching PRGlue
  15.     QuickDraw and animating PICTs (was re: XWindows)
  16.     Trap dereferencing considered harmful? (was: Drawing with the mouse)
  17.  
  18.  
  19.  
  20. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  21.  
  22. The digest is a collection of article threads from the internet newsgroup
  23. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  24. regularly and want an archive of the discussions.  If you don't know what a
  25. newsgroup is, you probably don't have access to it.  Ask your systems
  26. administrator(s) for details.  (This means you can't post questions to the
  27. digest.)
  28.  
  29. Each issue of the digest contains one or more sets of articles (called
  30. threads), with each set corresponding to a 'discussion' of a particular
  31. subject.  The articles are not edited; all articles included in this digest
  32. are in their original posted form (as received by our news server at
  33. cs.uoregon.edu).  Article threads are not added to the digest until the last
  34. article added to the thread is at least one month old (this is to ensure that
  35. the thread is dead before adding it to the digest).  Article threads that
  36. consist of only one message are generally not included in the digest.
  37.  
  38. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  39. [128.223.8.8] in the directory /pub/mac/csmp-digest.  The most recent issues
  40. are available from sumex-aim.stanford.edu [36.44.0.6] in the directory
  41. /info-mac/digest/csmp.  If you don't have ftp capability, the sumex archive
  42. has a mail server; send a message with the text '$MACarch help' (no quotes)
  43. to LISTSERV@ricevm1.rice.edu for more information.
  44.  
  45. The digest is also available via email.  Just send a note saying that you
  46. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  47. automatically receive each new issue as it is created.  Sorry, back issues
  48. are not available through the mailing list.
  49.  
  50. Send administrative mail to mkelly@cs.uoregon.edu.
  51.  
  52.  
  53. -------------------------------------------------------
  54.  
  55. From: Fuchs@EMBL-Heidelberg.DE (Rainer Fuchs)
  56. Subject: How to handle pdoc events - to quit or not to quit
  57. Date: 26 Jun 92 12:32:17 GMT
  58. Organization: EMBL Data Library
  59.  
  60. I have a question about the reaction to a pdoc AppleEvent:
  61.  
  62. A user can select a number of documents from the Finder and
  63. select Print. The Finder launches the application and sends a
  64. pdoc AppleEvent. What should the application do after processing
  65. the AppleEvent? Should it quit or not? The same question applies
  66. of course for System 6 and MultiFinder, where AppleEvents are
  67. not used.
  68.  
  69. I couldn't find any clear information about this issue. Looking at 
  70. what other people do, I found a couple of programs that quit after
  71. printing, but also many that don't.
  72.  
  73. Rainer Fuchs
  74. EMBL Data Library
  75. Fuchs@EMBL-Heidelberg.DE
  76.  
  77. +++++++++++++++++++++++++++
  78.  
  79. From: leonardr@ccs.itd.umich.edu
  80. Organization: Campus Computing Sites, University of Michigan-Ann Arbor
  81. Date: Sat, 27 Jun 92 18:27:23 GMT
  82.  
  83. In article <1992Jun26.133217.48202@embl-heidelberg.de> Fuchs@EMBL-Heidelberg.DE (Rainer Fuchs) writes:
  84. >I have a question about the reaction to a pdoc AppleEvent:
  85. >
  86. >A user can select a number of documents from the Finder and
  87. >select Print. The Finder launches the application and sends a
  88. >pdoc AppleEvent. What should the application do after processing
  89. >the AppleEvent? Should it quit or not? The same question applies
  90. >of course for System 6 and MultiFinder, where AppleEvents are
  91. >not used.
  92. >
  93.     It has always been the rule that you should QUIT after getting
  94. told by the user to print.  This has been true since the beginning of the Mac
  95. (MacPaint & MacWrite did it!) and is still true today when recieving pdoc 
  96. events.  
  97.     There are some application that don't do this, they're wrong!!
  98.  
  99. - -- 
  100. - -----------------------------------------------------------------------
  101. Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  102. Director of Advanced Technology   AppleLink: MACgician
  103. Aladdin Systems, inc.          GEnie:     MACgician
  104.  
  105. +++++++++++++++++++++++++++
  106.  
  107. From: siegel@world.std.com (Rich Siegel)
  108. Organization: GCC Technologies
  109. Date: Sat, 27 Jun 1992 21:09:33 GMT
  110.  
  111. In article <1992Jun27.182723.16884@terminator.cc.umich.edu> leonardr@ccs.itd.umich.edu writes:
  112. >>
  113. >    It has always been the rule that you should QUIT after getting
  114. >told by the user to print.  This has been true since the beginning of the Mac
  115. >(MacPaint & MacWrite did it!) and is still true today when recieving pdoc 
  116. >events.  
  117. >    There are some application that don't do this, they're wrong!!
  118.  
  119.     One must make allowances for changing times. Under System 7, 
  120. it's possible to get a 'pdoc' event while the program is already running
  121. (i.e. after having received an 'oapp', and not at startup time). In this
  122. case, it's desirable not to quit after servicing the 'pdoc' event.
  123.  
  124. R.
  125.  
  126. - -- 
  127. - -----------------------------------------------------------------------
  128. Rich Siegel                              Internet: siegel@world.std.com
  129. Software Engineer & Toolsmith
  130. GCC Technologies
  131.  
  132. +++++++++++++++++++++++++++
  133.  
  134. From: leonardr@ccs.itd.umich.edu
  135. Organization: Campus Computing Sites, University of Michigan-Ann Arbor
  136. Date: Sun, 28 Jun 92 04:05:34 GMT
  137.  
  138. In article <BqIw3y.Hst@world.std.com> siegel@world.std.com (Rich Siegel) writes:
  139. >In article <1992Jun27.182723.16884@terminator.cc.umich.edu> leonardr@ccs.itd.umich.edu writes:
  140. >>>
  141. >>    It has always been the rule that you should QUIT after getting
  142. >>told by the user to print.  This has been true since the beginning of the Mac
  143. >>(MacPaint & MacWrite did it!) and is still true today when recieving pdoc 
  144. >>events.  
  145. >>    There are some application that don't do this, they're wrong!!
  146. >
  147. >    One must make allowances for changing times. Under System 7, 
  148. >it's possible to get a 'pdoc' event while the program is already running
  149. >(i.e. after having received an 'oapp', and not at startup time). In this
  150. >case, it's desirable not to quit after servicing the 'pdoc' event.
  151. >
  152.     That's true, Rich, but the discussion was what to do when you get it
  153. at Application launch time.  Obvoiusly, if you've already been running and
  154. you THEN get a pdoc, you don't want to quit!
  155.  
  156. Leonard
  157.  
  158. - -- 
  159. - -----------------------------------------------------------------------
  160. Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  161. Director of Advanced Technology   AppleLink: MACgician
  162. Aladdin Systems, inc.          GEnie:     MACgician
  163.  
  164. +++++++++++++++++++++++++++
  165.  
  166. From: grobbins@Apple.COM (Grobbins)
  167. Date: 30 Jun 92 18:23:05 GMT
  168. Organization: Apple DTS
  169.  
  170. In article <1992Jun28.040534.24481@terminator.cc.umich.edu> leonardr@ccs.itd.umich.edu writes:
  171. >    That's true, Rich, but the discussion was what to do when you get it
  172. >at Application launch time.  Obvoiusly, if you've already been running and
  173. >you THEN get a pdoc, you don't want to quit!
  174.  
  175. No, a 'pdoc' means print, not quit, even at launch time.  Pasted below is 
  176. a Q&A which discusses the issue.
  177.  
  178. Grobbins            grobbins@apple.com
  179.  
  180. Usual disclaimers apply.
  181.  
  182. - ---
  183.  
  184.  
  185. from the Q&A Stack:
  186.  
  187. Toolbox & IAC:Apple Events:4/17/92
  188. LaunchApplication and event sequence
  189.  
  190. Is it the case that if I double-click on a document belonging to
  191. my application, my application will be launched and will receive
  192. an 'odoc' Apple event, but will not receive an 'oapp' event-that
  193. is to say, I will receive either 'odoc' or 'oapp', but not both?
  194.  
  195.  
  196. You are correct, except actually, it'll be either 'oapp' or 'odoc'
  197. or 'pdoc'. The 'pdoc' will be followed (as the next event) by a
  198. 'quit' if the 'pdoc' was the event sent as the application was
  199. launched.
  200.  
  201. This is the *normal* sequence of events, and should be adhered to
  202. by everyone who launches applications. However, it is not
  203. *enforced* by the system or Finder. It is possible for any
  204. application to launch you with *any* event, since they can stuff
  205. anything in the launchAppParameters field of LaunchApplication, as
  206. long as it's a valid high-level (not even Apple) event. This would
  207. be bad programming, and would break most launched applications,
  208. but you should be aware that someone who hasn't understood things
  209. may do this to you.
  210.  
  211. Note that if another application launches you using
  212. LaunchApplication and doesn't specify any high-level event in the
  213. launch parameter block, the Finder will automatically supply the
  214. 'oapp'. So, in general, in the correct way to code Apple events
  215. and launching, you will always get an 'oapp' XOR an 'odoc' XOR a
  216. 'pdoc'.
  217.  
  218.  
  219.  
  220.  
  221. ---------------------------
  222.  
  223. From: mkelly@Apple.COM (Michael Kelly)
  224. Subject: Changing addressing mode without rebooting
  225. Date: 27 Jun 92 21:50:23 GMT
  226. Organization: Apple Computer Inc., Cupertino, CA
  227.  
  228.  
  229. I've been using a Mac with a lot of memory the last few months, and so I need
  230. the machine to be in 32-bit addressing mode most of the time so that I can get
  231. to my memory.  Unfortunately, there are several programs that I like to use
  232. that are not 32-bit compatible (Word 4, e.g.).  When I want to use those
  233. programs, I have to turn 32-bit addressing off and restart.  I'm getting
  234. pretty fed up with having to do that.
  235.  
  236. Is it possible at all to switch the addressing mode without rebooting?  If it
  237. is, someone should write a control panel, similar to SpeedSwitch '040 in
  238. design, that would allow the user to turn 32-bit addressing on and off without
  239. rebooting.  Surely it must be possible, although I suspect it would be
  240. extremely difficult.
  241.  
  242. Does something like that already exist?
  243.  
  244. BTW, does anyone know of anything that will switch the cache setting on a
  245. Quadra automatically for each program?
  246.  
  247. Thanks,
  248.  
  249. Mike.
  250. - -- 
  251. _____________________________________________________________________________
  252. Michael A. Kelly                                         Apple Computer, Inc.
  253. mkelly@apple.com                 Advanced Technology Group, Graphics Software
  254. _____________________________________________________________________________
  255.  
  256. +++++++++++++++++++++++++++
  257.  
  258. From: keith@taligent.com (Keith Rollin)
  259. Date: 27 Jun 92 23:08:53 GMT
  260. Organization: Taligent
  261.  
  262. In article <69337@apple.Apple.COM>, mkelly@Apple.COM (Michael Kelly) writes:
  263. > I've been using a Mac with a lot of memory the last few months, and so I need
  264. > the machine to be in 32-bit addressing mode most of the time so that I can get
  265. > to my memory.  Unfortunately, there are several programs that I like to use
  266. > that are not 32-bit compatible (Word 4, e.g.).  When I want to use those
  267. > programs, I have to turn 32-bit addressing off and restart.  I'm getting
  268. > pretty fed up with having to do that.
  269. > Is it possible at all to switch the addressing mode without rebooting?  If it
  270. > is, someone should write a control panel, similar to SpeedSwitch '040 in
  271. > design, that would allow the user to turn 32-bit addressing on and off without
  272. > rebooting.  Surely it must be possible, although I suspect it would be
  273. > extremely difficult.
  274. > Does something like that already exist?
  275.  
  276. I don't think that something like what you describe exists, or ever will exist.
  277. You are probably correct that it is possible, but as Jim Reekes would put it, it
  278. would be "way hard." Not only would you have to hunt down every block allocated
  279. by the Memory Manager and convert it from 24/32 bit format to 32/24 bit format
  280. (this is the hardest part), but you'd also have to figure out which toolbox
  281. managers change their internal storage formats based on what mode the Mac is in
  282. (e.g., Window Manager, Control Manager) and change that data to the appropriate
  283. new format. This, too, is the hardest part. I figure that it would take someone
  284. who was already intimately familiar with all those parts of the system many
  285. months to come up with such a utility.
  286.  
  287. If I were you, I'd just get programs that worked under 32-bit mode. Companies
  288. that take the time to update their software for 32-bit mode, or who are
  289. conscientious enough to write their programs to be 32-bit compatible in the
  290. first place are the kinds of companies I like to support.
  291.  
  292. Word 5 is 32-bit compatible, as well as works on '040 Macs. I'm sure the Apple
  293. Engineering Library has it on their KeyServer.
  294.  
  295. - --
  296. Keith Rollin
  297. Phantom Programmer
  298. Taligent, Inc.
  299.  
  300.  
  301. ---------------------------
  302.  
  303. From: jonh@pogo.wv.tek.com (Jon Howell)
  304. Subject: The Answer to "Re: Serial output hangs"
  305. Date: 28 Jun 92 00:05:40 GMT
  306. Organization: Tektronix, Inc., Wilsonville,  OR.
  307.  
  308. From: bl668@cleveland.Freenet.Edu (David P. Alverson)
  309. >>    I'm getting started trying to write some data out the serial port.
  310. >>I don't have my code with me (it's as home), but it goes something like
  311. >>this (with error checking): [gross generalizations here]
  312. >>
  313. >>    OpenDriver(&refNum, ".AOut");
  314. >>    SerReset(refNum, baud1200+data8+stop20+parityNone);
  315. >>    FSWrite(refNum, strlen(mystring), mystring);
  316. >>
  317. >>When I plugged the cable into my modem, the debugging messages tell me I've
  318. >>made it all the way to the FSWrite, at which point it locks up. (I have to
  319. >
  320. >I would say its probably waiting for the CTS line.  Look at the SerHShake
  321. >call; you want to set fCTS and fDTR to zero in the SerShk record.
  322.  
  323. Thanks, Dave -- you were right on the money. I went home and tried this out
  324. (I even forgot fDTR [which left it non-zero]), and it worked fine. Thanks
  325. for taking the time to help me out.
  326.  
  327. I've included my modem init routine (after which I call the SerialSend routine
  328. I found in terminal.c, available from sumex-aim.stanford.edu /info-mac/source),
  329. because this will also be posted to c.s.m.p for other poor slobs of my
  330. small caliber. :v)
  331.  
  332. At any rate, it runs. Thanks!
  333.  
  334.     -- Jon
  335.  
  336. - ----snip snip----
  337. #include <Serial.h>
  338.  
  339. short    int sm_refOut, sm_refIn;
  340. Boolean    sm_sendBusy;
  341.  
  342. void serModemInit(void)
  343. {
  344.     SerShk flags;
  345.  
  346.     /*** Open output and input drivers ***/
  347.         if (OpenDriver("\p.AOut", &sm_refOut))
  348.         {    sm_refIn=sm_refOut=0;    return;    }
  349.         
  350.         if (OpenDriver("\p.AIn", &sm_refIn))
  351.         {    sm_refIn=sm_refOut=0;    return;    }
  352.     
  353.     /*** Set up communications paramaters ***/
  354.         if (SerReset(sm_refOut, baud1200+stop10+noParity+data8))
  355.         {    sm_refIn=sm_refOut=0;    return;    }
  356.         
  357.         if (SerReset(sm_refIn, baud1200+stop10+noParity+data8))
  358.         {    sm_refIn=sm_refOut=0;    return;    }
  359.     
  360.     /*** Set up handshaking ***/
  361.         flags.fXOn = TRUE;
  362.         flags.fCTS = FALSE;
  363.         flags.xOn  = '\021';
  364.         flags.xOff = '\023';
  365.         flags.errs = 0;
  366.         flags.evts = 0;
  367.         flags.fInX = TRUE;
  368.         flags.fDTR = TRUE;
  369.         
  370.         if (SerHShake(sm_refOut, &flags))
  371.         {    sm_refIn=sm_refOut=0;    return;    }
  372.                     
  373.         if (SerHShake(sm_refIn, &flags))
  374.         {    sm_refIn=sm_refOut=0;    return;    }
  375.     
  376.     /*** Clear busy flag so we're clear to transmit ***/
  377.     sm_sendBusy = FALSE;
  378.     
  379.     /* If we made it this far, the ports are ready to roll */
  380. }                
  381.  
  382. /* ----- Send buffer --------------------------------------------------- */
  383. /* taken from terminal.c, available on sumex-aim.stanford.edu under     */
  384. /* /info-mac/source (I think).                         */
  385.  
  386. #define OUTPUT sm_refOut
  387.  
  388. static pascal void SendComplete(void)
  389. {
  390.     /* A0 has address of IOParam */
  391.     asm {
  392.         MOVE.L    -4(A0),A0    /* Get busy flag address */
  393.         CLR.B    0(A0)        /* Clear the busy flag (FALSE) */
  394.     }
  395. }
  396.  
  397. void SerialSend(
  398.     register char *buffer,
  399.     register long count,
  400.     register Boolean *busy)
  401. {
  402.     static struct {        /* Must be static! */
  403.         Boolean *busy;    /* TRUE while sending */
  404.         IOParam b;
  405.     } param;
  406.  
  407.     if (!OUTPUT) {
  408.         *busy = FALSE;
  409.         return;
  410.     }
  411.     *busy = TRUE;
  412.     param.busy = busy;
  413.     param.b.ioCompletion = (ProcPtr)SendComplete;
  414.     param.b.ioRefNum = OUTPUT;
  415.     param.b.ioBuffer = (Ptr)buffer;
  416.     param.b.ioReqCount = count;
  417.     PBWrite((ParmBlkPtr)¶m.b, TRUE);        /* Asynchrone */
  418. }
  419. - -- 
  420. Jon Howell jonh@pogo.wv.tek.com | 503/657-7964h 503/685-3048ofc | What good is
  421.     having someone who can walk on water if you don't follow in his footsteps?
  422.  
  423. ---------------------------
  424.  
  425. From: jbush@magnus.acs.ohio-state.edu (J Eric Bush)
  426. Subject: Backgrounding Question?
  427. Organization: The Ohio State University
  428. Date: Mon, 29 Jun 1992 01:09:10 GMT
  429.  
  430. Does anyone know of a way to make an application (or force an application) into
  431. the background?  I know that when the MouseClick is placed in another 
  432. application, the current application is sent to the background under System 7.
  433. But, can you force an application to the background, or return to the Finder 
  434. without quitting the application?
  435.  
  436. Please send replies to: jbush@magnus.acs.ohio-state.edu
  437.  
  438. If anyone is interested in the answer, send mail, and I will send you whatever 
  439. is sent to me.
  440.  
  441. Thanks in advance.
  442. Eric Bush
  443. - -- 
  444. - ------------------------------------------------------------------------------
  445. J. Eric Bush
  446. Internet: jbush@magnus.acs.ohio-state.edu   ProLine: eric@pro-tcc.cts.com
  447. GEnie:    KITCHEN.SINK
  448.  
  449. +++++++++++++++++++++++++++
  450.  
  451. From: Anders Wallgren <anders@verity.com>
  452. Organization: Verity, Inc., Mountain View, CA, USA
  453. Date: Mon, 29 Jun 92 01:53:14 GMT
  454.  
  455. In article <1992Jun29.010910.2031@magnus.acs.ohio-state.edu> J Eric
  456. Bush, jbush@magnus.acs.ohio-state.edu writes:
  457. >Does anyone know of a way to make an application (or force an
  458. application) into
  459. >the background?  I know that when the MouseClick is placed in
  460. another 
  461. >application, the current application is sent to the background
  462. under System 7.
  463. >But, can you force an application to the background, or return to
  464. the Finder 
  465. >without quitting the application?
  466.  
  467. Use SetFrontProcess() to force a process (other than the one you
  468. want to background) into the foreground, thus sending this other
  469. process to the background.  I don't know of any way to explicitly
  470. put a process in the background.
  471.  
  472. anders
  473.  
  474. ---------------------------
  475.  
  476. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  477. Subject: _Delay should be banned
  478. Date: 29 Jun 92 19:34:15 +1200
  479. Organization: University of Waikato, Hamilton, New Zealand
  480.  
  481. Lately I've been having problems with a piece of commercial software which
  482. shall remain nameless. This program tries periodically to open a file. When
  483. it fails, because the file is already open for conflicting access by someone
  484. else, it calls the OS Utilities "Delay" function to delay for 60 seconds, then
  485. tries again.
  486.  
  487. Now, the implementation of Delay has not changed *one whit*, as far as I'm
  488. aware, from its original 1984-vintage implementation. It sits in a tight,
  489. CPU-bound loop until a specified number of ticks has elapsed. Now, this may
  490. have been acceptable in pre-MultiFinder times, but these days, commission
  491. of a Delay call is definitely an unfriendly act.
  492.  
  493. It's strange that I recall no mention of the use of Delay in conjunction with
  494. MultiFinder-friendliness, in any of Apple's documentation or guidelines.
  495. Basically, *don't* use it for any but the very shortest delays (a fraction
  496. of a second is probably OK). At least try and let background tasks run while
  497. you're waiting for whatever it is you're waiting for.
  498.  
  499. I suppose that the reason why Apple can't reimplement Delay to allow
  500. background tasks to run is because you could then have memory movements
  501. happening in the system heap (as a consequence of OS calls from background
  502. tasks), which could break some programs. Sigh...
  503.  
  504. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  505. Computer Services Dept                     fax: +64-7-838-4066
  506. University of Waikato            electric mail: ldo@waikato.ac.nz
  507. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  508.  
  509. +++++++++++++++++++++++++++
  510.  
  511. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  512. Date: 29 Jun 92 11:29:15 GMT
  513. Organization: Royal Institute of Technology, Stockholm, Sweden
  514.  
  515. .ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  516.  
  517.    I suppose that the reason why Apple can't reimplement Delay to allow
  518.    background tasks to run is because you could then have memory movements
  519.    happening in the system heap (as a consequence of OS calls from background
  520.    tasks), which could break some programs. Sigh...
  521.  
  522. Not to mention that some apps draw in the WMgrPort, call Delay, and
  523. then reset the port. If someone was to draw in between...
  524.  
  525. It's sad that the mac wasn't designed for preemption from the very
  526. beginning. Now we will have to use a new API for the preemptively
  527. multitasking kernel.
  528.  
  529. I'm talking A/UX, of course, what else did you think ? :-)
  530.  
  531. - -- 
  532.          Jon W{tte, Svartmangatan 18, S-111 29 Stockholm, Sweden
  533.  
  534.  "Difficult, obscure, incoherent and nonstandard does not imply more power."
  535.                - Andrew Kass in comp.sys.mac.hardware
  536.  
  537. ---------------------------
  538.  
  539. From: jverdega@cae.wisc.edu (Jeffrey Verdegan)
  540. Subject: 'vers' resource conventions
  541. Date: 29 Jun 92 14:53:52 GMT
  542. Organization: U of Wisconsin-Madison College of Engineering
  543.  
  544. I was just editing the 'vers' resource of my app in ResEdit 2.1.1, when I
  545. realized something a little strange.  There are the three fields at the top,
  546. x.y.z, which correspond to major revision, minor revision, and bug fix, or
  547. something like that.  Then there's the release, Development, Alpha, Beta,
  548. Final, which I assume correspond to the b in 1.2b3, etc.  But then, next to
  549. that is a number field "non-release."  What, if any, are the conventions
  550. regarding this field.  I realize the 'vers' resource is not exactly a carved-
  551. in-stone standard, but there seem to be some reasonably well followed
  552. conventions.  Where does non-release fit into these?
  553.  
  554. Not a world-shaking problem, just a nagging little curiosity. =:-)
  555.  
  556. Thanks,
  557. Jeff
  558.  
  559.  
  560. - ----------
  561.  
  562. Jeff Verdegan
  563. University of Wisconsin-Madison
  564. Computer-Aided Engineering Center
  565. jjv@caestaff.engr.wisc.edu
  566. (608) 263-1875
  567.  
  568. +++++++++++++++++++++++++++
  569.  
  570. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  571. Organization: University of Illinois at Urbana
  572. Date: Mon, 29 Jun 1992 15:40:16 GMT
  573.  
  574. jverdega@cae.wisc.edu (Jeffrey Verdegan) writes:
  575.  
  576. >I was just editing the 'vers' resource of my app in ResEdit 2.1.1, when I
  577. >realized something a little strange.  There are the three fields at the top,
  578. >x.y.z, which correspond to major revision, minor revision, and bug fix, or
  579. >something like that.  Then there's the release, Development, Alpha, Beta,
  580. >Final, which I assume correspond to the b in 1.2b3, etc.  But then, next to
  581. >that is a number field "non-release."  What, if any, are the conventions
  582. >regarding this field.  I realize the 'vers' resource is not exactly a carved-
  583. >in-stone standard, but there seem to be some reasonably well followed
  584. >conventions.  Where does non-release fit into these?
  585.  
  586. In something like "1.2b3", the "3" is the non-release version number.
  587. "1.2b3" is actually "1.2.0b3". When writing it out in text, people
  588. drop the bug-fix version number if it is equal to 0. The major release
  589. number and the non-release number begin with 1, and the minor release
  590. number and bug fix number begin with 0. So, my first alpha test
  591. version of my second bug fix version of a program which was previously
  592. at version 3.4 would be "3.4.2b1". Neat, huh?
  593.  
  594. pr
  595. - --
  596. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  597. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  598. System manager - Cognitive Science Group, Beckman Institute, UIUC
  599. Internet: resnick@cogsci.uiuc.edu
  600.  
  601. +++++++++++++++++++++++++++
  602.  
  603. From: timm@void.ncsa.uiuc.edu (Coffee Junkie)
  604. Date: 29 Jun 92 15:54:44 GMT
  605. Organization: University of Illinois at Urbana
  606.  
  607. Pete Resnick writes
  608. > So, my first alpha test
  609. > version of my second bug fix version of a program which was previously
  610. > at version 3.4 would be "3.4.2b1". Neat, huh?
  611.                                 ^
  612.                                 a.
  613. - --
  614. Tim McClarren     | "...a bajillion brilliant Jobsian lithium licks."
  615. timm@ncsa.uiuc.edu|
  616. (217)244-0015     |
  617.  
  618. +++++++++++++++++++++++++++
  619.  
  620. From: andyp@treehouse.UUCP (Andy Peterman)
  621. Date: 29 Jun 92 20:50:11 GMT
  622. Organization: The Treehouse
  623.  
  624. In article <1992Jun29.095353.24353@doug.cae.wisc.edu> jverdega@cae.wisc.edu (Je
  625. ffrey Verdegan) writes:
  626. >I was just editing the 'vers' resource of my app in ResEdit 2.1.1, when I
  627. >realized something a little strange.  There are the three fields at the top,
  628. >x.y.z, which correspond to major revision, minor revision, and bug fix, or
  629. >something like that.  Then there's the release, Development, Alpha, Beta,
  630. >Final, which I assume correspond to the b in 1.2b3, etc.  But then, next to
  631. >that is a number field "non-release."  What, if any, are the conventions
  632. >regarding this field.  I realize the 'vers' resource is not exactly a carved-
  633. >in-stone standard, but there seem to be some reasonably well followed
  634. >conventions.  Where does non-release fit into these?
  635.  
  636. The three fields of x.y.z refer to a version number like 1.2.3 where the 3 is 
  637. the bug fix field.  In a version like 1.2b3, the 3 is the "non-release" number.
  638. There's actually four number fields, although the "non-release" field is never 
  639. shown for "release".  It's possible to have a version 1.2.3b4, which would be 
  640. the beta 4 version of bug fix 3 for minor revison 2 of major version 1 (whew!).
  641.  
  642. The 'vers' resources ARE carved-in-stone.  See Tech Note 189 or IM VI.  It's 
  643. actually a very nice system, especially because there's a 32 bit value that 
  644. corresponds to the version number that will always increase for newer versions.
  645. - -- 
  646. Andy Peterman                       
  647. treehouse!andyp@gvgpsa.gvg.tek.com  
  648. (916) 273-4569                      
  649.  
  650. ---------------------------
  651.  
  652. From: sshws@convx1.lerc.nasa.gov (Herb Schilling)
  653. Subject: Info on the Twain API available ? 
  654. Organization: NASA Lewis Research Center
  655. Date: Mon, 29 Jun 1992 16:06:19 GMT
  656.  
  657.  
  658. Does anyone know where we can get information about the TWAIN API that is 
  659. being proposed ( and implemented, I guess )? It supposedly establishes
  660. a device independent interface to input devices such as scanners. MacWeek
  661. reports that Wordperfect will be using it.
  662.  
  663. Thanks in advance. I will summarize any responses I get.
  664. - -- 
  665. Herb Schilling , NASA Lewis Research Center , 21000 Brookpark Road, MS 142-5
  666. Cleveland, Ohio 44135 . (216) 433-8955       sshws@convx1.lerc.nasa.gov
  667.  
  668. +++++++++++++++++++++++++++
  669.  
  670. From: sshws@convx1.lerc.nasa.gov (Herb Schilling)
  671. Date: 30 Jun 92 11:15:57 GMT
  672. Organization: NASA Lewis Research Center
  673.  
  674. In article <1992Jun29.160619.3059@eagle.lerc.nasa.gov> sshws@convx1.lerc.nasa.gov (Herb Schilling) writes:
  675. >
  676. >Does anyone know where we can get information about the TWAIN API that is 
  677. >being proposed ( and implemented, I guess )? It supposedly establishes
  678. >a device independent interface to input devices such as scanners. MacWeek
  679. >reports that Wordperfect will be using it.
  680.  
  681. I will answer my own question ! You can call 800-722-0379 to order a TWAIN
  682. toolkit. If you have access to Compuserve, look in the HPPER libraries for
  683. TWAIN.
  684.  
  685.  
  686. - -- 
  687. Herb Schilling , NASA Lewis Research Center , 21000 Brookpark Road, MS 142-5
  688. Cleveland, Ohio 44135 . (216) 433-8955       sshws@convx1.lerc.nasa.gov
  689.  
  690. ---------------------------
  691.  
  692. From: resnick@cogsci.uiuc.edu (Pete Resnick)
  693. Subject: Dialog Manager *too* 32-bit clean (was Re: Modal Dialog horrors and cdev's)
  694. Organization: University of Illinois at Urbana
  695. Date: Tue, 30 Jun 1992 07:20:06 GMT
  696.  
  697. This was one of the most stressful debugging sessions I have ever had.
  698. I thought I would post to let all of you know the solution because this
  699. could bite anyone. For those who didn't see the initial post, I was
  700. getting really screwy looking, half drawn dialog boxes and crashes from
  701. a code resource I had written. Though I thank all those who sent
  702. e-mail, I should tell you that the problem was not caused by THINK C's
  703. A4 globals or by SetPort/GetPort mistakes.
  704.  
  705. The problem seems to be that the Dialog and/or Window Manager are not
  706. being 24-bit friendly. I created my dialogs using the dStorage
  707. parameter to NewDialog. The storage I used were DialogRecords I had
  708. declared as global variables. The mistake that I made was that I made
  709. calls to the Dialog and Window Manager routines using the address of
  710. those structures rather than the address returned to me from the
  711. NewDialog call. So, I was doing the following:
  712.  
  713. NewDialog(&myDRec, ....);
  714. [...]
  715. CloseDialog(&myDRec);
  716.  
  717. It turns out that if you do this, you *must* call StripAddress for all
  718. subsequent calls: on a Mac SE, the top byte of that address you pass
  719. to CloseDialog will be garbage and it is *that* that screws up the
  720. Dialog Manager. My solution was to put the returned value from
  721. NewDialog into another global and do the following:
  722.  
  723. myDPtr = NewDialog(&myDRec, ....);
  724. [....]
  725. CloseDialog(myDPtr);
  726.  
  727. That works fine. I don't know, but all this seems kinda icky of the
  728. Dialog Manager to do.
  729.  
  730. pr
  731. - --
  732. Pete Resnick             (...so what is a mojo, and why would one be rising?)
  733. Graduate assistant - Philosophy Department, Gregory Hall, UIUC
  734. System manager - Cognitive Science Group, Beckman Institute, UIUC
  735. Internet: resnick@cogsci.uiuc.edu
  736.  
  737. +++++++++++++++++++++++++++
  738.  
  739. From: gurgle@netcom.com (Pete Gontier)
  740. Date: Tue, 30 Jun 92 14:58:11 GMT
  741. Organization: cellular
  742.  
  743. resnick@cogsci.uiuc.edu (Pete Resnick) writes:
  744.  
  745. >The problem seems to be that the Dialog and/or Window Manager are not
  746. >being 24-bit friendly. I created my dialogs using the dStorage
  747. >parameter to NewDialog. The storage I used were DialogRecords I had
  748. >declared as global variables. The mistake that I made was that I made
  749. >calls to the Dialog and Window Manager routines using the address of
  750. >those structures rather than the address returned to me from the
  751. >NewDialog call. So, I was doing the following:
  752.  
  753. >NewDialog(&myDRec, ....);
  754. >[...]
  755. >CloseDialog(&myDRec);
  756.  
  757. THINK C code resources address their globals relative to A4. But they
  758. don't set up A4, as you know. You have to set it up yourself, throught
  759. RememberA0 and SetUpA4 or something similar.
  760.  
  761. RememberA0, of course, gets the value it "remembers" from register A0.
  762. And, on entry to your code resource, the THINK code resource glue has
  763. put a pointer to the code resource in A0.
  764.  
  765. Here's the problem: the THINK code resource startup glue gets the value
  766. of A0 via a 0 code offset. In other words, the glue knows the distance
  767. between the instruction that sets up A0 and the first instruction in
  768. the code resource and uses that. This is done via an offset from the
  769. PC register. In a 24 bit system, the PC may well be 32-bit dirty,
  770. because the system likely simply jumps to a master pointer it got
  771. from the resource manager.
  772.  
  773. If the PC is 32-bit dirty, this dirtiness propagates all the way down
  774. to A4, and as soon as you pass the address of a global variable to
  775. somebody, it's not 32-bit clean. Ick.
  776.  
  777. You can clean this up with a short assembly language routine which
  778. might look something like this:
  779.  
  780. static void CleanPC (void)
  781. {
  782.     asm
  783.     {
  784.         LEA @1,A0
  785.         MOVE.L A0,D0
  786.         _StripAddress
  787.         MOVE.L D0,A0
  788.         JMP (A0)
  789. @1
  790.     }
  791. }
  792.  
  793. Try this out before you trust it; I just typed it out impromptu.
  794.  
  795. Anyway, the real question here is "Why does the dialog manager care
  796. about a dirty upper byte when the SE couldn't use it even if it wanted to?"
  797. - -- 
  798.  Pete Gontier // EC Technology // gurgle@netcom.com
  799.  
  800. ---------------------------
  801.  
  802. From: sho@gibbs.physics.purdue.edu (Sho Kuwamoto)
  803. Subject: Does the threads library work with THINK C?
  804. Date: 30 Jun 92 07:50:24 GMT
  805. Organization: Purdue University Physics Department
  806.  
  807. 1) Does the threads library work under THINK C?
  808. 2) Is the threads library still available on the Develop CD?
  809. 3) How do I subscribe to Develop?
  810.  
  811. Thanks.
  812.  
  813. - -Sho
  814. - --
  815. sho@physics.purdue.edu
  816.  
  817. +++++++++++++++++++++++++++
  818.  
  819. From: mlanett@Apple.COM (Mark Lanett)
  820. Date: 30 Jun 92 18:24:32 GMT
  821. Organization: Apple Computer Inc., Cupertino, CA
  822.  
  823. sho@gibbs.physics.purdue.edu (Sho Kuwamoto) writes:
  824.  
  825. >1) Does the threads library work under THINK C?
  826.  
  827. I had heard of someone using it with Think. I don't know what's involved. Since
  828. you don't get the source, it can't be much trouble. It may have had to do
  829. with pascal functions.
  830.  
  831. >2) Is the threads library still available on the Develop CD?
  832.  
  833. All the developer CDs have all back issues on them. The threads articles were
  834. in develop 6 and 7, but a newer version was released in 8 (although it was in
  835. the 6 folder!).
  836.  
  837. >3) How do I subscribe to Develop?
  838.  
  839. Try DEV.SUBS@applelink.apple.com. Note, however, that all issues are on
  840. ftp.apple.com in dts/mac/docs/develop.
  841.  
  842. >Thanks.
  843. Enjoy.
  844. - -- 
  845. Have a bajillion brilliant Jobsian lithium licks.
  846. Mark Lanett
  847.  
  848. ---------------------------
  849.  
  850. From: wadew@ducvax.auburn.edu (Wade Williams)
  851. Subject: Patching PRGlue
  852. Organization: Auburn University
  853. Date: Tue, 30 Jun 1992 13:17:58 GMT
  854.  
  855. OK, here's one I've been trying to solve for a while with no success:
  856.  
  857. I'm trying to write a patch to PRGlue that will password-protect printing
  858. operations.  In reality, I might end up patching PROpenDoc or something like
  859. that, but the principle is the same.
  860.  
  861. Because this patch needs to be active at all times, regardless of what
  862. application is running, I've surmised that the best technique is probably for
  863. my INIT to load a standalone CODE resource into memory, then patch PRGlue. 
  864. When someone tries to print, the PRGlue patch will jump them to my standalone
  865. code, which displays a dialog prompting them for a password.
  866.  
  867. The problem is, if the user enters the correct password, we then need to jump
  868. from the standalone code to the true PRGlue Trap address.  The problem is, how
  869. can I pass that Trap address from the INIT which installs the trap to my
  870. standalone code?
  871.  
  872. (Listening for the groans)
  873.  
  874. By the way, I don't know assembly, so you can't say "just push it on the stack"
  875. or something similar.  (I know, I know, it's crazy for someone who doesn't
  876. understand assembly to go around patching traps and writing INITs, but I'm the
  877. best we've got - a depressing thought).  Also, the standalone code won't be
  878. called until the first time someone tries to print, so it might be hours until
  879. the standalone code has to actually fetch the original PRGlue Trap address.
  880.  
  881. And finally, if A4 is setup properly, can I use the Dialog Manager in my CODE
  882. resource?
  883.  
  884. Thanks,
  885. Wade
  886.  
  887. - -------------------------------------------------------------------------
  888. Wade Williams                             "Any escape might help to smooth the 
  889. User Services Specialist            unattractive truth, but the suburbs
  890. Academic Computing                     have no charms to soothe the restless
  891. Auburn University                      dreams of youth." (N. Peart)
  892. wadew@ducvax.auburn.edu
  893. - -------------------------------------------------------------------------
  894.  
  895. +++++++++++++++++++++++++++
  896.  
  897. From: zobkiw@world.std.com (Joe Zobkiw)
  898. Organization: The World Public Access UNIX, Brookline, MA
  899. Date: Wed, 1 Jul 1992 12:34:20 GMT
  900.  
  901. "just push it on the stack"
  902.  
  903. Just kidding...look up NGetTrapAddress and NSetTrapAddress. Also, if you are
  904. using THINK C I would recommend writing at least _some_ of the patch in asm.
  905.  
  906. Good luck.
  907.  
  908.  
  909. - -- 
  910. - -- joe zobkiw                      Internet: zobkiw@world.std.com
  911. - --                                      AOL: AFL Zobkiw  
  912. - -- mac.synthesis.MIDI.THINK C.OOP
  913. - -- asm.comm.networks.cool tunes...
  914.  
  915. ---------------------------
  916.  
  917. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  918. Subject: QuickDraw and animating PICTs (was re: XWindows)
  919. Organization: Kalamazoo College
  920. Date: Mon, 29 Jun 1992 21:39:05 GMT
  921.  
  922. hugh@rschp1.anu.edu.au (Hugh Fisher) writes:
  923. >k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
  924. >> 
  925. >> I'm not sure what you mean by "serious hassles."  Lawrence hinted that X
  926. >> doesn't support friendly, powerful sharing of a color table by multiple
  927. >> windows, which the Palette Manager provides.  If true, perhaps that's
  928. >> why offscreen images seem hard--the power doesn't come for free.
  929. >> Actually, I don't know how offscreen images could have been done more
  930. >> straightforwardly without sacrificing efficiency.
  931. >
  932. >  I wrote an article on this for MacTutor magazine after I had done
  933. >  the color version of a Mac game (Fire Brigade). Briefly,
  934. >
  935. >  With the original palette manager, you couldn't store offscreen PICTs
  936. >  with animating colors. The Palette Manager prevented 'ordinary' drawing
  937. >  calls from getting at pixels reserved for animation. If you set up an
  938. >  offscreen pixmap for use with animating colors and tried to draw a PICT
  939. >  in it, the PICT came out in black and white. You couldn't draw it and
  940. >  then set up the animation pixel values either, or at least not by following
  941. >  the Mac API.
  942.  
  943. This relates to a question in a previous article, which I'll attempt to
  944. answer before going on:
  945.  
  946. From: wardw@CS.ColoState.EDU (william bradley ward)
  947. Subject: Animating PICT colors
  948. Date: 28 Jun 92 01:19:56 GMT
  949.  
  950. >Anybody have any idea how to animate the colors of a PICT, as I'm at
  951. >a loss on how to do so?
  952. >
  953. >My problem is that I can animate "normal" colors that I draw manually
  954. >(using LineTo, FrameCRect, etc) fine, but I am unable to animate those
  955. >same exact colors when they are in a pre-saved PICT resource.
  956. >
  957. >I am using the same palette of colors, that the PICT uses, for the animation
  958. >process.  For example, I displayed the PICT, picked a color from the PICT,
  959. >and drew a line in that color in the same window.  I then animated that color
  960. >(had it cycle through many shades of gray).  The line animated fine, but
  961. >the same color in the PICT itself did not change.
  962.  
  963. The problem is that any color declared as pmAnimated won't be picked as
  964. a match by any QuickDraw routines.  When you draw "manually" with them,
  965. you're using PmForeColor() to tell the Palette Manager to tell QuickDraw
  966. to set the drawing color directly.  But if you use RGBForeColor(),
  967. QuickDraw will ask the Palette Manager to match the color, and the
  968. Palette Manager will never return an animated color in that case.
  969.  
  970. Now, I don't know much about PICTs, but I don't see the PmXxxColor()
  971. calls in the list of opcodes for pictures--which makes sense, they're
  972. not QuickDraw calls.  Fortunately, there's an easy way around this, but
  973. it requires 32-bit QuickDraw.  This is what Hugh is talking about up
  974. there.
  975.  
  976. You need to first draw the picture into an offscreen pixmap.  Use the
  977. PICT's clut for that pixmap.  Then you need to use a 32-bit QD feature
  978. to get that onto the screen with the appropriate colors.  Specifically,
  979. you need to set the "value" fields of the offscreen pixmap's color
  980. table's entries to be the _palette_ entries of the window you're drawing
  981. into.  If your PICT is 20 shades of green, you just need 20 pmAnimated
  982. shades of green in the palette.  They don't have to match the clut;  if
  983. the value field of color #3 is 200, then color #3 will be mapped onto
  984. palette entry 200.
  985.  
  986. Then set bit 14 of the offscreen pixmap's color table's ctFlags field to
  987. one, and call CopyBits().  This mapping-to-a-palette thing only works
  988. for CopyBits, only when bit 14 is set, and only when you're drawing to a
  989. window (because only windows can have palettes).
  990.  
  991. Back to Hugh:
  992.  
  993. >  This all got fixed with 32 bit Quickdraw and the new pmExplicit + colors,
  994. >  which, sorry to labour the point, is much more like X Windows: there is
  995. >  a nice, straightforward 1:1 mapping between stored pixel values and index
  996. >  numbers in palettes/color tables.
  997.  
  998. Nope.  It's more flexible than that.  William, if you want to map all
  999. twenty of the offscreen pixmap's colors onto three palette entries, you're
  1000. free to do so.  Also, being pmExplicit has nothing to do with it:  you
  1001. can copy into pmCourteous colors if you want.
  1002.  
  1003. pmExplicit colors allow speed freaks to control the color tables and
  1004. still go through the Palette Manager.  They're useful when you want to
  1005. write directly to the screen, which most animation/paint programs do
  1006. anyway--so not being able to go through the Toolbox is not nearly as bad
  1007. as it sounds.  And explicit colors have been in from day one.  My
  1008. Copyright 1988 IM V declares pmExplicit on page 167.
  1009.  
  1010. >  The
  1011. >  specification of an X Windows color table entry has three 16 bit
  1012. >  fields for red, green, and blue; and a 32 bit field for the actual
  1013. >  pixel value. The Mac format has the same fields but only 8 bits
  1014. >  for the pixel.
  1015.  
  1016. Sixteen, actually.  Not that it matters.  And, yes, things get
  1017. complicated when you start calling AnimatePalette(), I know.
  1018.  
  1019. >  It did cause some trouble. The first few 24 bit color displays from
  1020. >  Radius, etc had to patch the system software and had compatibility
  1021. >  problems.
  1022.  
  1023. Hm!  I didn't realize this--interesting.
  1024. - -- 
  1025.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  1026.  "Whenever I open the manuals for OOP, I have the strangest desire to find
  1027.   the nearest pillow and fall asleep."   - David Denboer
  1028.  
  1029. ---------------------------
  1030.  
  1031. Subject: Trap dereferencing considered harmful? (was: Drawing with the mouse)
  1032. From: hammett@sbsu1.aukuni.ac.nz (Tim Hammett)
  1033. Date: Tue, 30 Jun 1992 22:22:12 GMT
  1034. Organization: University of Auckland, New Zealand.
  1035.  
  1036. rae@alias.com (Reid Ellis) writes:
  1037. >Would the code benefit from GetTrapAddress() to avoid the toolbox trap
  1038. >mechanism?  Or does this have the unfortunate side effect of possibly
  1039. >deaccellerating and Quickdraw accellerators running?
  1040.  
  1041. Frequently people mention using GetTrapAddress() to get the address of a trap
  1042. so that they can then jump directly to the trap and thus avoid trap
  1043. dispatcher overhead. Although this seems to be a frequently used technique,
  1044. I wonder about the future compatibility of this trick. Some possible
  1045. concerns are:
  1046.  
  1047. 1. If the application is running in the 680x0 user mode, and the trap
  1048.    being called does something that requires the processor to be in
  1049.    supervisor mode. In this case I'd assume that using the normal trap
  1050.    mechanism would put the processor in supervisor mode, while bypassing
  1051.    the normal trap mechanism would leave it in user mode.
  1052.  
  1053. 2. If memory protection is implemented in the future (I know the system
  1054.    heap makes this difficult), and the trap routine writes to some
  1055.    memory area that is protected from being directly written by the
  1056.    application code (e.g. some I/O registers, or even the screen memory).
  1057.    Once again, bypassing the trap mechanism & jumping into the ROM
  1058.    directly might cause some problems.
  1059.  
  1060. So, am I being needlessly paranoid, or is bypassing the trap dispatcher
  1061. a potential cause of compatibility problems?
  1062.  
  1063. TIA,
  1064.     --- Tim.
  1065.  
  1066.  
  1067.  
  1068. - --
  1069. Tim Hammett, Botany Dept, Auckland University, New Zealand.
  1070. t.hammett@aukuni.ac.nz   Phone: +64-9-373-7599 x8365    FAX: +64-9-373-7416
  1071.  
  1072. +++++++++++++++++++++++++++
  1073.  
  1074. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  1075. Organization: Royal Institute of Technology, Stockholm, Sweden
  1076. Date: Wed, 1 Jul 1992 00:30:35 GMT
  1077.  
  1078. .ac.nz> hammett@sbsu1.aukuni.ac.nz (Tim Hammett) writes:
  1079.  
  1080.    Frequently people mention using GetTrapAddress() to get the address of a trap
  1081.    so that they can then jump directly to the trap and thus avoid trap
  1082.    dispatcher overhead. Although this seems to be a frequently used technique,
  1083.    I wonder about the future compatibility of this trick. Some possible
  1084.    concerns are:
  1085.  
  1086. This is a bad idea, generally.
  1087.  
  1088.    1. If the application is running in the 680x0 user mode, and the trap
  1089.       being called does something that requires the processor to be in
  1090.       supervisor mode. In this case I'd assume that using the normal trap
  1091.       mechanism would put the processor in supervisor mode, while bypassing
  1092.       the normal trap mechanism would leave it in user mode.
  1093.  
  1094. Presumably. This is important enough, but:
  1095.  
  1096.    2. If memory protection is implemented in the future (I know the system
  1097.       heap makes this difficult), and the trap routine writes to some
  1098.       memory area that is protected from being directly written by the
  1099.       application code (e.g. some I/O registers, or even the screen memory).
  1100.       Once again, bypassing the trap mechanism & jumping into the ROM
  1101.       directly might cause some problems.
  1102.  
  1103. Yes, and even more important: RISC !
  1104.  
  1105. RISC Macs will execute traps in "native" code, which is not directly
  1106. executable by the MC68kX emulator. Maybe Apple kludges up something
  1107. to fix this, but don't bet on it.
  1108.  
  1109.    So, am I being needlessly paranoid, or is bypassing the trap dispatcher
  1110.    a potential cause of compatibility problems?
  1111.  
  1112. Don't do it unless you can turn it off in the program (and it's
  1113. by default off)
  1114.  
  1115. - -- 
  1116.          Jon W{tte, Svartmangatan 18, S-111 29 Stockholm, Sweden
  1117.  
  1118.  "Difficult, obscure, incoherent and nonstandard does not imply more power."
  1119.                - Andrew Kass in comp.sys.mac.hardware
  1120.  
  1121. ---------------------------
  1122.  
  1123. End of C.S.M.P. Digest
  1124. **********************
  1125.